home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / lang / fpc09905c.lha / fpc / units / prt0.as < prev    next >
Text File  |  1998-09-21  |  977b  |  57 lines

  1.  
  2.    .text
  3.  
  4.    .align 4
  5.  
  6.    .globl _start
  7.    .globl start
  8. _start:
  9. start:
  10. |    Save stack pointer for exit() routine
  11.  
  12.     movel       sp,STKPTR    | save stack pointer
  13. | This was wrong compared to PCQ
  14. |    addl       #4,STKPTR    | account for this jsr to get to original
  15.  
  16. |    Save the command line pointer to CommandLine
  17.  
  18.     movel    a0,__ARGS
  19.     beq    .Ldont_nullit
  20.  
  21.  
  22. | Remove $0a character from end of string
  23.     movew  d0,d1
  24.     subqw  #1,d1
  25.     cmpb   #0x0a,a0@(0,d1:w)
  26.     bne    .Lcontt
  27. | Decrement count by one to remove the $0a character
  28.     movew  d1,d0
  29.  .Lcontt:
  30.      moveb  #0,a0@(0,d0:w)       | null terminate it
  31.     movew  d0,__ARGC
  32.  .Ldont_nullit:
  33.  
  34.     jsr PASCALMAIN
  35.  
  36.     movel  STKPTR,sp
  37.     rts
  38.  
  39.     .data
  40.  
  41.     .align 4
  42.  
  43.     .globl __ARGS
  44.  __ARGS:                   | pointer to the arguments
  45.       .long 0
  46.     .globl  __ARGC
  47.  __ARGC:                    | number of arguments
  48.       .word 0
  49.     .globl STKPTR          | Used to terminate the program, initial SP
  50.  STKPTR:
  51.       .long 0
  52.  
  53.  
  54.  
  55.  
  56.  
  57.